package com.ruoyi.web.controller.sequence;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.construction.ConstructionInfo;
import com.ruoyi.system.domain.vo.ApiBuildingVo;
import com.ruoyi.system.service.construction.ConstructionInfoService;
import com.ruoyi.system.service.vantservice.teamservice.ApiBuildingVoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/system/shigong")
public class ShiGongController extends BaseController {


    @Autowired(required = false)
    private ApiBuildingVoService apiBuildingVoService;
    @Autowired(required = false)
    private ConstructionInfoService constructionInfoService;

    @GetMapping(value ="/shigongList")
    public TableDataInfo shigongList(ApiBuildingVo apiBuildingVo){
        startPage();
        List<ApiBuildingVo> allList = apiBuildingVoService.shigongList(apiBuildingVo);
        return getDataTable(allList);
    }


    @GetMapping(value = "/getshigongId/{constructionId}")
    public AjaxResult getInfo(@PathVariable("constructionId") Long constructionId)
    {
        return AjaxResult.success(constructionInfoService.caseInfoById(constructionId));
    }

    @PutMapping(value = "/shigongEdit")
    public AjaxResult edit(@RequestBody ConstructionInfo constructionInfo)
    {
        return toAjax(constructionInfoService.updateConstructionInfo(constructionInfo));
    }


}
